package com.mentalhealthplatform.schoolV1.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Set;
import java.util.UUID;

@Getter
@Setter
@NoArgsConstructor
public class UserDTO {
    private UUID id;
    private String username;
    private String phone;
    private boolean status;

    // 忽略前端请求中的 roles 字段
    @JsonIgnore
    private Set<RoleSimpleDTO> roles;

    // 全参构造方法
    public UserDTO(UUID id, String username, String phone,boolean status, Set<RoleSimpleDTO> roles) {
        this.id = id;
        this.username = username;
        this.phone = phone;
        this.status = status;
        this.roles = roles;
    }

    // 确保后端响应时 roles 字段能够正常映射
    @JsonProperty("roles")
    public Set<RoleSimpleDTO> getRoles() {
        return roles;
    }

}
